'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: google_serper.py
* @Time: 2025/9/22
* @All Rights Reserve By Brtc
'''
from langchain_core.tools import BaseTool
from pydantic import BaseModel, Field
from langchain_community.tools import GoogleSerperRun
from langchain_community.utilities import GoogleSerperAPIWrapper
from internal.lib.helper import add_attribute


class GoogleSerperArgsSchema(BaseModel):
    """谷歌搜索的API参数描述"""
    query:str = Field(description="需要检索的问题")

@add_attribute("args_schema", GoogleSerperArgsSchema)
def google_serper(**kwargs)->BaseTool:
    """谷歌搜索工具实例化"""
    return GoogleSerperRun(
        name = "google_serper",
        description="这是一个低成本的谷歌搜索工具，可以使用该工具搜索内容.",
        api_wrapper=GoogleSerperAPIWrapper(),
    )